﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta http-equiv="Access-Control-Allow-Origin" content="*">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta http-equiv="Pragma" content="no-cache">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="format-detection" content="telephone=no" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <link href="css/ydui.css" rel="stylesheet" />
    <link href="css/styles.css" rel="stylesheet" />
    <script src="Script/jquery-1.10.2.js"></script>
    <script src="layer/layer.js"></script>
    <script type="text/javascript" src="Script/ydui.flexible.js"></script>
    <script type="text/javascript" src="Script/sys-verification2.5.js"></script>
    <title></title>
</head>
<body>
    <section class="g-flexview">
        <!--<header class="m-navbar">
            <a href="asidebar.html" class="navbar-item"><i class="back-ico"></i></a>
            <div class="navbar-center"><span class="navbar-title">菜品评价</span></div>
        </header>-->
        <br/>
        <section class="g-scrollview  Start_scrollview">
            <div class="title_hall margin02"><i class="icon_title"></i>菜品评价</div>
            <div class="m-cell announcement">
                <ul class="appraisalstyle" id="appraisal">
                    <li class="appraisal_level">
                        <span class="Required cell-item" data-key="satisfied" data-type="satisfied" data-Array="非常满意,满意,一般,不满意" data-value="0" data-method="SelectionBox" data-mode="radio">
                        </span>
                    </li>
                    <li class="keyword clearfix">
                        <span class="Required info_data" data-key="keyword" data-type="keyword" data-Array="服务周到,效率高,处理快,温馨解答问题,服务满意,服务态度恶劣" data-value="" data-method="SelectionBox" data-mode="checkbox"> </span>

                    </li>
                    <li class="padding02 ">
                        <textarea data-name="评价内容" id="textarea" data-prompt="text_content" data-type="summary" data-key="summary" data-verify="verify" data-stint="Wordcount" size="300" class="Required form-textarea col-sm-12 textarea height100 mr10" placeholder="请对服务做个简单评价"></textarea>

                    </li>
                    <li class="padding02">
                        <button type="button" class="btn-block btn-bule" id="modifybtn1">发布</button>
                    </li>
                    <li class="jsoncontent" id="jsoncontent">

                    </li>
                </ul>
            </div>
        </section>
    </section>
</body>
</html>

<script type="text/javascript">

    //页面刷新
    function myrefresh() {
        window.location.reload();
    }


    new SYSVerification({
        Verification: 'appraisal', //验证区域
        Submit: 'modifybtn1', //提交按钮名称
        Empty: 'Emptybtn1',
        Datamode: 'json',
        FailurePrompt: '添加失败请从新输入', //请求失败提示
        Formmode: 'submitmode',
        SubmitMethod: function (index, data, newarr) { //index方法集合  data为拼接形式，不适合待&标签的文本内容 ,newarr为json格式
            var mode = index.par.Datamode;
            if (mode == "json") {
                var str = JSON.stringify(newarr);
                var json = str.replace(/\[|]/g, '');
                var items = JSON.parse(json);
                var satisfied = items.satisfied;
                var summary = items.summary;

                //请求方法
                $.ajax({
                    type: "post",
                    url: "../MenuReserveHandler.ashx",
                    data: {
                        satisfied: satisfied,
                        summary: summary,
                        funcname: "Increase_Dish_Evaluation"
                    },
                    dataType: "json",
                    success: function (data) {
                        if (data <= 0) {
                            index.PromptBox("评价失败", 2);
                            return false;
                        } else {
                            index.PromptBox("评价成功", 2);
                            //指定1秒刷新一次
                            setTimeout('myrefresh()', 2000);
                        }
                    }

                })


                //  ID$('jsoncontent').innerHTML = json;
                // index.PromptBox("评价成功", 2);
                //index.ajaxPost('../../php/submit.php?action=insertjson',null, json); //url地址，data获取数据
            }
        }, //提交验证回调方法
        Load: function (index, conttext) { }, //加载数据用于获取数据
        ConfirmCallback: function (index, data) {

            index.PromptBox("评价成功", 2);
        }, //确认回调方法
        Expand: function (index) { }, //扩展
        ExtendMethod: function (index, conttext) {
            var muster = index.getByClass(conttext[1], 'ace');
            for (var i = 0; i < muster.length; i++) {
                muster[i].onclick = function (e) {
                    var evt = e || window.event;
                    var tar = evt.target || evt.srcElement;
                    var text = tar.parentNode.innerText;
                    if (tar.checked == true) {
                        ID$('textarea').value += text + ' ,';
                    } else {
                        var content = ID$('textarea').value;
                        ID$('textarea').value = content.replace(text + ' ,', '');
                    }
                }
            }
        }
    });
</script>